#include <base/reflection.hpp>
#include <log/log.h>
#include <iostream>
#include <string>

namespace log {

Log::Log()
{ }

Log::Log(const Log& old)
{ }

Log::~Log() 
{
    std::cout << "~log::Log()" << std::endl;
}


void Log::fillDefaultConfig() const 
{

}

bool Log::initialize() 
{
    initSink(async_stdout_sink_);
    async_file_sink_.setFilePath("/home/ycb/MyGitHub/cpp-log/sdpcie_log");
    async_file_sink_.setFilePrefix("test");
    initSink(async_file_sink_); 
    return true;
}

void Log::cleanup()
{
    async_file_sink_.disable();
    async_stdout_sink_.disable();
    // async_syslog_sink_.disable();

    async_file_sink_.cleanup();
    async_stdout_sink_.cleanup();
    // async_syslog_sink_.cleanup();
}

void Log::setFilePath(const std::string& file_path)
{
    async_file_sink_.setFilePath(file_path);
}

void Log::makeReflectable(const std::string& ref_id)
{
    reflect::AddClass<Log>(ref_id)
             .AddMemberFunction("setFilePath", &Log::setFilePath);
}

void Log::initSink(log::Sink &ch) 
{ 
    ch.enable();
}

}